package com.itaming.lycheeframework.api.config;

import com.itaming.lycheeframework.api.exception.ExceptionResolver;
import com.itaming.lycheeframework.api.exception.GlobalExceptionHandler;
import com.itaming.lycheeframework.support.properties.ExtendedPropertySource;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;

import java.util.List;

/**
 * API模块配置类
 *
 * @author A.Ming
 */
@AutoConfiguration
@ExtendedPropertySource({"classpath:lychee-api.yml"})
public class LycheeApiConfiguration {

    /**
     * 全局异常处理器
     */
    @Bean
    public GlobalExceptionHandler globalExceptionHandler(List<ExceptionResolver> exceptionResolvers) {
        return new GlobalExceptionHandler(exceptionResolvers);
    }

}
